home *** CD-ROM | disk | FTP | other *** search
- #include <stdio.h>
- #include <graphics.h>
- /* Define a fill pattern */
- char fillpat[8] =
- {1, 3, 7, 0xf, 0x1f, 0x3f, 0x7f, 0xff},
- oldpat[8]; /* Placeholder for old fill pattern */
- main()
- {
- int graphdriver = DETECT, graphmode;
- char buffer[80];
-
- /* Initialize the graphics system */
- initgraph(&graphdriver, &graphmode, "c:\\turboc");
- outtextxy(10, 20, "Demonstrating getfillpattern");
-
- /* Define a new pattern */
- setfillpattern(fillpat, RED);
- getfillpattern(oldpat);
- sprintf(buffer, "Current fill pattern is: %x %x %x %x %x %x %x %x",
- oldpat[0],oldpat[1],oldpat[2],oldpat[3],oldpat[4],oldpat[5],oldpat[6],
- oldpat[7]);
- outtextxy(10, 40, buffer);
- outtextxy(10, 60, "Here is how it looks:");
- /* Draw a bar with current fill pattern */
- bar(100, 100, 140, 200);
- /* Give user a chance to see the result */
- outtextxy(10, 220, "Hit any key to exit:");
- getch();
- closegraph();
- }